<template>
  <div class="son">
    <h1>{{ son }}</h1>
    <p>{{ data }}</p>
    <p>兄弟传过来的值： {{ value }}</p>
    <button @click="click">再给son组件传个值：{{brother}}</button>
  </div>
</template>

<script>
import eventbus from "./eventbus.js";

export default {
  name: "value",
  components: {},
  data() {
    return {
      son: "第二个子组件？？？",
      data: "20000",
      value: "",
      brother:'two'
    };
  },
  props: {},
  methods: {
    click(){
      eventbus.$emit("twovalue",this.brother)
    }
  },
  computed: {},
  created() {
    eventbus.$on("add", (message) => {
      //一些操作，message就是从top组件传过来的值
      this.value = message;
    });
  },
};
</script>

<style lang="less" scoped>
// .sales-board-des {
//   border-top: 20px solid #f0f2f5;
//   padding: 15px 20px;
// }
.son {
  width: 1000px;
  height: 120px;
  border: 2px solid rgb(148, 126, 228);
  margin-top: 10px;
  margin-left: 150px;
}
</style>